package cn.seocoo.platform.freeback.service.impl;

import java.util.List;

import cn.seocoo.platform.common.constant.ClassContants;
import cn.seocoo.platform.freeback.domain.Freeback;
import cn.seocoo.platform.freeback.mapper.FreebackMapper;
import cn.seocoo.platform.freeback.service.IFreebackService;
import cn.seocoo.platform.user.domain.AppUser;
import cn.seocoo.platform.user.mapper.AppUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.seocoo.platform.common.core.text.Convert;

/**
 * 意见反馈 服务层实现
 * 
 * @author wujian
 * @date 2019-12-19
 */
@Service
public class FreebackServiceImpl implements IFreebackService
{
	@Autowired
	private FreebackMapper freebackMapper;

	@Autowired
	private AppUserMapper appUserMapper;



	/**
     * 查询意见反馈信息
     * 
     * @param id 意见反馈ID
     * @return 意见反馈信息
     */
    @Override
	public Freeback selectFreebackById(Integer id)
	{
	    return freebackMapper.selectFreebackById(id);
	}
	
	/**
     * 查询意见反馈列表
     * 
     * @param freeback 意见反馈信息
     * @return 意见反馈集合
     */
	@Override
	public List<Freeback> selectFreebackList(Freeback freeback)
	{
	    return freebackMapper.selectFreebackList(freeback);
	}
	
    /**
     * 新增意见反馈
     * 
     * @param freeback 意见反馈信息
     * @return 结果
     */
	@Override
	public int insertFreeback(Freeback freeback)
	{
		Integer appUserId = freeback.getAppUserId();
		AppUser appUser = appUserMapper.selectAppUserById(appUserId);
		freeback.setCreateBy(appUser.getLoginName());
		freeback.setDelFlag(ClassContants.NO_DEL_FLAG);
		return freebackMapper.insertFreeback(freeback);
	}
	
	/**
     * 修改意见反馈
     * 
     * @param freeback 意见反馈信息
     * @return 结果
     */
	@Override
	public int updateFreeback(Freeback freeback)
	{
	    return freebackMapper.updateFreeback(freeback);
	}

	/**
     * 删除意见反馈对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteFreebackByIds(String ids)
	{
		return freebackMapper.deleteFreebackByIds(Convert.toStrArray(ids));
	}

	@Override
	public List<Freeback> selectPcFreebackList(Freeback freeback) {
		return freebackMapper.selectPcFreebackList(freeback);
	}

}
